package com.knowif.service;

import com.knowif.dao.InterviewExperienceMapper;
import com.knowif.pojo.InterviewExperience;
import com.knowif.pojo.InterviewExperienceExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：Xh
 * @date ：Created in 2019/5/4 0004 21:28
 */
@Service
public class InterviewExperience_service {

    @Autowired
    private InterviewExperienceMapper interviewExperienceMapper;

    /**
     * InterviewExperience条件查询
     * @param interviewExperienceExample
     * @return
     */
    public List<InterviewExperience> selectInterviewExperience(InterviewExperienceExample interviewExperienceExample){
        return interviewExperienceMapper.selectByExample(interviewExperienceExample);
    }

    /**
     * 条件统计
     * @param interviewExperienceExample
     * @return int
     */
    public int countInterviewExperienceByParams(InterviewExperienceExample interviewExperienceExample){
        return interviewExperienceMapper.countByExample(interviewExperienceExample);
    }

    /**
     * 条件删除
     * @param interviewExperienceExample
     * @return int
     */
    public int deleteInterviewExperienceExampleByParams(InterviewExperienceExample interviewExperienceExample){
        return interviewExperienceMapper.deleteByExample(interviewExperienceExample);
    }

    /**
     * 插入不为空的
     * @param interviewExperience
     * @return int
     */
    public int saveInterviewExperienceNotNull(InterviewExperience interviewExperience){
        return interviewExperienceMapper.insertSelective(interviewExperience);
    }

    /**
     * 通过主键查询面经
     * @param primaryKey
     * @return InterviewExperience
     */
    public InterviewExperience selectInterviewExperienceById(Integer primaryKey){
        return interviewExperienceMapper.selectByPrimaryKey(primaryKey);
    }

    /**
     * 通过参数更新不为空的
     * @param interviewExperience
     * @param interviewExperienceExample
     * @return
     */
    public int updateInterviewExperienceNotNullByParams(InterviewExperience interviewExperience, InterviewExperienceExample interviewExperienceExample){
        return interviewExperienceMapper.updateByExampleSelective(interviewExperience, interviewExperienceExample);
    }

    /**
     * 通过参数更新所有
     * @param interviewExperience
     * @param interviewExperienceExample
     * @return
     */
    public int updateInterviewExperienceByParams(InterviewExperience interviewExperience, InterviewExperienceExample interviewExperienceExample){
        return interviewExperienceMapper.updateByExample(interviewExperience, interviewExperienceExample);
    }


    /**
     * 插入interviewExperience
     * @param interviewExperience
     * @return
     */
    public int saveInterviewExperience(InterviewExperience interviewExperience){
        return interviewExperienceMapper.insert(interviewExperience);
    }

    /**
     * 更新不为空的interviewExperience属性
     * @param interviewExperience
     * @return
     */
    public int updateInterviewExperienceNotNull(InterviewExperience interviewExperience){
        return interviewExperienceMapper.updateByPrimaryKeySelective(interviewExperience);
    }

    /**
     * 更新所有interviewExperience属性
     * @param interviewExperience
     * @return
     */
    public int updateInterviewExperience(InterviewExperience interviewExperience){
        return interviewExperienceMapper.updateByPrimaryKey(interviewExperience);
    }

    /**
     * 删除interviewExperience
     * @param interviewExperienceId
     */
    public int deleteInterviewExperience(int interviewExperienceId){
        return interviewExperienceMapper.deleteByPrimaryKey(interviewExperienceId);
    }
}
